<%@page import="java.util.List"%>
<%@page import="biblioteca.Prestamo"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Adimistracion de prestamos</title>

<script type="text/javascript">

function carga() {
	document.getElementById("idsocio").focus();
}


function guardar(){
		var forma = document.getElementById("formaPrestamos");
		forma.action= "adminPrestamos.servlet";
		var accion = document.getElementById("accion");
		accion.value="guardar";
		forma.submit();
}	
function actualizar(){
	var forma = document.getElementById("formaPrestamos");
	forma.action= "adminPrestamos.servlet";
	var accion = document.getElementById("accion");
	accion.value="actualizar";
	forma.submit();
}
function borrar(){
	var forma = document.getElementById("formaPrestamos");
	forma.action= "adminPrestamos.servlet";
	var accion = document.getElementById("accion");
	accion.value="borrar";
	forma.submit();
}


</script>

<script type="text/javascript" languaje="JavaScript">
	function carga() {
		document.getElementById("usuario").focus();
	}

</script> 

</head>
<body onload="carga()" background="indice.jpg">
<form action="" method="POST" id="formaPrestamos">
<center>
<input type="hidden" name="accion" id="accion">
<p align="left">
<a href="welcome.jsp"><input type="button" value="Menu de administracion"></a>
</p>

<p style="font-weight: bold; size: 20px;">
Bienvenido al sistema de administracion de prestamos
</p>

</head>
<body>

	<table>
<tr>
<td style="font-weight: bold; size: 12px; color: blue;"align="right">ID Socio :</td>
<td><input type="text" name="idsocio" id="idsocio"></td>
</tr>
<tr>
<td style="font-weight: bold; size: 12px; color: blue;"align="right">ID-Libro :</td>
<td><input type="text" name="id" id="id"></td>
</tr>

<td colspan="2">
<input type="button" value="Pedir" style="font-size: 14px; color: blue;" onclick="guardar();">
<input type="button" value="Eliminar" style="font-size: 14px; color: blue;"onclick="borrar();">
</td>

</table>
	
<table align="center">
<tr>
<th >ID-Socio</th><th>ID-Libro</th>
</tr>
<% 
List<Prestamo> prestamo = (List<Prestamo>)session.getAttribute("listaPrestamo");
for(Prestamo obj : prestamo){
	%>	
	<tr>
	<td><%= obj.getIdSocio() %></td>
	<td><%= obj.getId() %></td>
	</tr>	
<%
}
%>
</table>

</body>
</html>